package edu.gyc.data.struct;

public class HiSearch {


    public static void main(String[] args) {
        String src="abclo vlove54flov ef' dflove abcdf";
        String target="love";
        int n=src.length() - target.length();
        String[] works = new String[n];
        for (int i = 0; i <n; i++) {
            works[i] = src.substring(i, i + 4);
        }
        int t=-1;
        for (int i = 0; i < n; i++) {
            if (works[i].equals(target)) {
               t=i;
               break;
            }
        }
        if (t==-1) {
            System.out.println("sorry,not found ");

        }else {
            System.out.println(target + " is at " + t);
        }
    }
}
